<admintpl file="header" />
</head>
<body>
	<div class="wrap">
		<ul class="nav nav-tabs">
			
			<li class="active">添加车辆</li>
		</ul>
		<form method="post" class="form-horizontal js-ajax-form" action="{:U('Tingche/cl_addPost')}">
			<fieldset>
				
				<div class="control-group">
					<label class="control-label">小区名称:</label>
					<div class="controls">
						<select  onchange="xl();" id="xq"name="xqid">
                                                      <option selected="selected" >请选择小区</option>
                                                      <foreach name="xqs" item="v">
                                                  
                                                    <option value="{$v.id}">{$v.name}</option>
                                                   </foreach>    
						</select>
						<span class="form-required">*</span>
					</div>
				</div>
				<div class="control-group">
					<label class="control-label">车位区域名称:</label>
					<div class="controls">
						<select  onchange="oncw();" id="area"name="areaid">
                                                      
						</select>
						<span class="form-required">*</span>
					</div>
				</div>
				<div class="control-group">
					<label class="control-label">车位号:</label>
					<div class="controls">
						<select  onchange="cl();" id="cw" name="cheweiid">
                                                      
						</select>
						<span class="form-required">*</span>
					</div>
				</div>
			
				<div class="control-group">
					<label class="control-label">车位状态:</label>
					<div class="controls">
						<input type="text" name="cwstatus">
						<span class="form-required">*</span>
					</div>
				</div>
				<div class="control-group">
					<label class="control-label">停车卡号:</label>
					<div class="controls">
						<input type="text" name="tckahao" id="action">
						<span class="form-required">*</span>
					</div>
				</div>
				<div class="control-group">
					<label class="control-label">车主姓名:</label>
					<div class="controls">
						<input type="text" name="chezhuname" id="action">
                                                <span class="form-required">*</span>
					</div>
				</div>
				<div class="control-group">
					<label class="control-label">车主手机号:</label>
                                        <div class="controls">
				                <input type="text" name="chezhuphone" id="action">
                                                <span class="form-required">*</span>
				</div>
                                        </div>
                            	<div class="control-group">
					<label class="control-label">车牌号码:</label>
					<div class="controls">
						<input type="text" name="carnumber" id="action">
                                                <span class="form-required">*</span>
					</div>
				</div>
                            	<div class="control-group">
					<label class="control-label">车辆排量:</label>
					<div class="controls">
						<input type="text" name="carpailiang" id="action">
                                                <span class="form-required">*</span>
					</div>
				</div>
                          
				<input type="text" style="display: none" name="xqname" id="xqyc"  value="" >
                                <input type="text" style="display: none" name="cwarea" id="areayc"  value="" >
                                  <input type="text" style="display: none" name="cwnumber" id="chewei"  value="" >
			</fieldset>
			<div class="form-actions">
				<button type="submit" class="btn btn-primary js-ajax-submit">{:L('ADD')}</button>
				<a class="btn" href="{:U('Tingche/carManager')}">{:L('BACK')}</a>
			</div>
		</form>
	</div>
	<!--<script src="__PUBLIC__/js/common.js"></script>-->
         <script>

            function xl(){
                var cwnb=document.getElementById("chewei");
                var lyy=document.getElementById('areayc');
                var xqy=document.getElementById('xqyc');
               var cq=document.getElementById("xq");
               var e=document.getElementById("area");
               var cw=document.getElementById("cw");
                 xqy.value=cq.options[cq.selectedIndex].text;
               var obj = {};
                obj.id = cq.value;
                e.length=0;
                  cw.length=0;
         $.post("{:U('Tingche/cwadd_change')}", obj,
         function(data,status) {
          if(data){
         var list = eval("("+data+")");   
          for(var i in list){   
             e[i]=new Option(list[i].cwarea,list[i].id);
 }    
       }else{
           
       }
     lyy.value=e.options[e.selectedIndex].text;
     var chewei={};
     chewei.id=e.value;
   
       $.post("{:U('Tingche/cladd_change')}", chewei,
         function(res,state) {
            if(res){
         var lst = eval("("+res+")");   
          for(var i in lst){   
             cw[i]=new Option(lst[i].cwnumber,lst[i].id);
 }    
            }    
             cwnb.value=cw.options[cw.selectedIndex].text;
    });

      });

            }
            
            function oncw(){
                  var e=document.getElementById("area");
                 var cwnb=document.getElementById("chewei");
                  var cw=document.getElementById("cw");
                var lyyc=document.getElementById('areayc');
               
                lyyc.value=e.options[e.selectedIndex].text;
                     var chewei={};
     chewei.id=e.value;
     cw.length=0;
       $.post("{:U('Tingche/cladd_change')}", chewei,
         function(data,status) {
            if(data){
         var list = eval("("+data+")");   
          for(var i in list){   
             cw[i]=new Option(list[i].cwnumber,list[i].id);
 }    
            }    
             cwnb.value=cw.options[cw.selectedIndex].text;
    });
            }
     
    function cl(){
        
          var lyyc=document.getElementById('chewei');
                var stt=document.getElementById('cw');
                lyyc.value=stt.options[stt.selectedIndex].text;
        
    }
            </script>
</body>
</html>